package com.city.eduservice.controller.front;

import com.city.commonutils.Result;
import com.city.eduservice.entity.EduCourse;
import com.city.eduservice.entity.EduTeacher;
import com.city.eduservice.service.EduCourseService;
import com.city.eduservice.service.EduTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Cheng
 * Date: 2020/9/20
 * Time: 22:36
 * Description: No Description
 */
@RestController
@RequestMapping("/eduservice/indexfront")
@CrossOrigin
public class IndexFeontController {
    //查询首页的前8条数据和四名教师
    @Autowired
    private EduTeacherService eduTeacherService;

    @Autowired
    private EduCourseService eduCourseService;

    @GetMapping("index")
    public Result index(){
        //8门课程
        List<EduCourse> list =eduCourseService.getEightCourse();

        //4位讲师
        List<EduTeacher> list1 = eduTeacherService.getForTeacher();
        return Result.ok().data("eduList",list).data("teacherList",list1);
    }
}
